﻿// <copyright file="Player.xaml.cs" company="Ucaya">
// </copyright>
// <author>Ucaya</author>

namespace Channel9Kinect
{
    #region

    using System;
    using System.Windows.Controls;
    using System.Windows.Media.Animation;

    using Channel9Kinect.Navigation;

    using MediaRss;

    #endregion

    /// <summary>
    ///   Interaction logic for Player.xaml
    /// </summary>
    public partial class Player : Page, IPageParameter<MediaRssItem>
    {
        #region Constants and Fields

        private readonly PlayerViewModel playerViewModel;

        #endregion

        #region Constructors and Destructors

        public Player()
        {
            this.InitializeComponent();
            this.playerViewModel = (PlayerViewModel)this.Resources["playerViewModel"];
            this.playerViewModel.MediaElement = this.player;
            this.playerViewModel.StartPlaying += this.playerViewModel_StartPlaying;
        }

        #endregion

        #region Public Methods

        public void LoadParameter(MediaRssItem paramerter)
        {
            this.playerViewModel.Item = paramerter;
        }

        #endregion

        #region Methods

        private void playerViewModel_StartPlaying(object sender, EventArgs e)
        {
            var sb = (Storyboard)this.Resources["CloseSummary"];
            sb.Begin();
        }

        #endregion
    }
}